Fix amusifier Python 3.13 compatibility #1083
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here are some small fixes to make the amusifier not crash on Python 3.13. I've tested this manually on 3.13 and also on 3.8 to check for regressions, and it works on both.
To explain:
In attributes.py,
dict
is the namespace of the class, so it contains the parameter declarations in the classes but also a bunch of variables made by Python. The latter all have dunder names, the former don't, but instead of checking the name of the key, we check the type of the value. Python 3.13 added a new variable that happens to have an empty tuple as its value, so we crash.In
base.py
,function
isNone
(by design, apparently) andNone
used to have a__doc__
that wasNone
, but in Python 3.13 it's a string describing theNone
object. So it's no longer the case that any object that has a__doc__
also has a__name__
, because nowNone
has the former but not the latter. That was questionable anyway. So there's an extra check forNone
here.Fixes #1082